home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / Token.java < prev    next >
Text File  |  1998-06-30  |  3KB  |  101 lines

  1. /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
  2. /*
  3.  * @(#)Token.java    1.5 98/03/12
  4.  * 
  5.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  6.  * 
  7.  * This software is the confidential and proprietary information of Sun
  8.  * Microsystems, Inc. ("Confidential Information").  You shall not
  9.  * disclose such Confidential Information and shall use it only in
  10.  * accordance with the terms of the license agreement you entered into
  11.  * with Sun.
  12.  * 
  13.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  14.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  15.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  16.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  17.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  18.  * THIS SOFTWARE OR ITS DERIVATIVES.
  19.  * 
  20.  */
  21. package com.sun.java.swing.text.html;
  22.  
  23. /**
  24.  * Describes the input token stream.
  25.  */
  26.  
  27. class Token {
  28.  
  29.   /**
  30.    * An integer that describes the kind of this token.  This numbering
  31.    * system is determined by JavaCCParser, and a table of these numbers is
  32.    * stored in the file ...Constants.java.
  33.    */
  34.   public int kind;
  35.  
  36.   /**
  37.    * beginLine and beginColumn describe the position of the first character
  38.    * of this token; endLine and endColumn describe the position of the
  39.    * last character of this token.
  40.    */
  41.   public int beginLine, beginColumn, endLine, endColumn;
  42.  
  43.   /**
  44.    * The string image of the token.
  45.    */
  46.   public String image;
  47.  
  48.   /**
  49.    * A reference to the next regular (non-special) token from the input
  50.    * stream.  If this is the last token from the input stream, or if the
  51.    * token manager has not read tokens beyond this one, this field is
  52.    * set to null.  This is true only if this token is also a regular
  53.    * token.  Otherwise, see below for a description of the contents of
  54.    * this field.
  55.    */
  56.   public Token next;
  57.  
  58.   /**
  59.    * This field is used to access special tokens that occur prior to this
  60.    * token, but after the immediately preceding regular (non-special) token.
  61.    * If there are no such special tokens, this field is set to null.
  62.    * When there are more than one such special token, this field refers
  63.    * to the last of these special tokens, which in turn refers to the next
  64.    * previous special token through its specialToken field, and so on
  65.    * until the first special token (whose specialToken field is null).
  66.    * The next fields of special tokens refer to other special tokens that
  67.    * immediately follow it (without an intervening regular token).  If there
  68.    * is no such token, this field is null.
  69.    */
  70.   public Token specialToken;
  71.  
  72.   /**
  73.    * Returns the image.
  74.    */
  75.   public final String toString()
  76.   {
  77.      return image;
  78.   }
  79.  
  80.   /**
  81.    * Returns a new Token object, by default. However, if you want, you
  82.    * can create and return subclass objects based on the value of ofKind.
  83.    * Simply add the cases to the switch for all those special cases.
  84.    * For example, if you have a subclass of Token called IDToken that
  85.    * you want to create if ofKind is ID, simlpy add something like :
  86.    *
  87.    *    case MyParserConstants.ID : return new IDToken();
  88.    *
  89.    * to the following switch statement. Then you can cast matchedToken
  90.    * variable to the appropriate type and use it in your lexical actions.
  91.    */
  92.   public static final Token newToken(int ofKind)
  93.   {
  94.      switch(ofKind)
  95.      {
  96.        default : return new Token();
  97.      }
  98.   }
  99.  
  100. }
  101.